'''
元组：定义的元素不可修改-数字，字符串，bool
定义：1、()，2、tuple()
'''
t1 = (1,2.2,True,"python",[1,2,3],(1,2,3),{1,2,3},{"name":"xiaoming"})
print(t1,type(t1))
# 获取某个数据
num = t1[4][1]
print(num)
# 元素中是列表，列表里的数据可以修改
t1[4][1] = 5
print(t1[4],type(t1[4]))
# 元素不可修改
# t1[0] = "asd"
# print(t1)

t2 = (("python","java","C++"),(1,2,3),"python")
print(t2[0][1])
print(t2.count("python"))
print(t2.index("python"))
# for while
for item in t2:
    print(item)

for item in t2[0]:
    print(item)

count = 0
while count < len(t2):
    print(t2[count])
    count += 1

# 定义一个元素的元组时，需要在后面加上一个逗号
t6 = ("123")
print(t6,type(t6))
t7 = (2,)
print(t7,type(t7))